package com.imay.live.view.custom;

import android.content.Context;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.imay.live.R;
import com.imay.live.activity.RoomLiveShortActivity;
import com.imay.live.activity.RoomPushShortActivity;
import com.imay.live.analytics.MobclickAgent;

/**
 * Created by liangzhenxiong on 2017/04/11 0011.
 */

public class SupperDekaronLayout extends RelativeLayout {


    public SupperDekaronLayout(Context context) {
        super(context);
        init(context);
    }

    public SupperDekaronLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public SupperDekaronLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    @RequiresApi(api = 21)
    public SupperDekaronLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        init(context);
    }

    void init(final Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_supperdekaron_layout, this, true);
        LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.height = (int) getResources().getDimension(R.dimen.dekaron_height);
        view.setLayoutParams(params);
        findViewById(R.id.dekoron).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                RoomPushShortActivity.startActivity(getContext());
                MobclickAgent.onEvent(context, "tiaozhan_click");

            }
        });
        findViewById(R.id.newdekoron).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                RoomPushShortActivity.startActivity(getContext(), true);
                MobclickAgent.onEvent(context, "chuti_click");

            }
        });
    }
}
